package com.androidx.p013lv.invention.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import com.androidx.p013lv.base.bean.InventionThreeBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.invention.C1069R;
import com.bumptech.glide.Glide;
import java.util.List;

/* renamed from: com.androidx.lv.invention.adapter.AdapterThreeHead */
public class AdapterThreeHead extends BaseRecyclerAdapter<InventionThreeBean, Holder> {
    String domain;
    Fragment fragment;
    int index = 0;

    public AdapterThreeHead(Fragment fragment2, String str, List<InventionThreeBean> list) {
        this.list = list;
        this.fragment = fragment2;
        this.domain = str;
    }

    public void setIndex(int i) {
        this.index = i;
        notifyDataSetChanged();
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((InventionThreeBean) this.list.get(i), i);
    }

    public void onViewRecycled(Holder holder) {
        super.onViewRecycled((RecyclerView.ViewHolder) holder);
        ImageView imageView = holder.iv_head;
        if (imageView != null) {
            Glide.with(imageView.getContext()).clear(imageView);
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(C1069R.C1074layout.item_three_head, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.androidx.lv.invention.adapter.AdapterThreeHead$Holder */
    public class Holder extends BaseRecyclerHolder {
        ImageView iv_head;
        RelativeLayout rl_selected;
        TextView tv_name;

        public Holder(View view) {
            super(view);
            this.iv_head = (ImageView) view.findViewById(C1069R.C1072id.iv_head);
            this.rl_selected = (RelativeLayout) view.findViewById(C1069R.C1072id.rl_selected);
            this.tv_name = (TextView) view.findViewById(C1069R.C1072id.tv_name);
        }

        public void setData(InventionThreeBean inventionThreeBean, int i) {
            if (AdapterThreeHead.this.index == i) {
                this.rl_selected.setBackgroundResource(C1069R.C1071drawable.shape_threee_head_selected);
            } else {
                this.rl_selected.setBackground(null);
            }
            Fragment fragment = AdapterThreeHead.this.fragment;
            GlideUtils.loadCirclePicHeadWh(fragment, AdapterThreeHead.this.domain + inventionThreeBean.getHeadImg(), this.iv_head, 150, 150);
            this.tv_name.setText(inventionThreeBean.getContentName());
        }
    }
}
